<?php

session_start();

include_once "src/controller/blmanagement/ResourceManagement.php";
include_once "src/model/Resource.php";
include_once "src/misc/ClientReponseGenerator.php";

try {
    $resource = new Resource();
    $resource->setResourceId($_POST["editResourceId"]);
    $resource->setResourceName($_POST["editResourceName"]);
    $resource->setResourceDescription($_POST["editResourceDescription"]);
    $resource->setResourceLocation($_POST["editResourceLocation"]);
    $resource->setResourceGroup($_POST["editResourceGroupName"]);
    $resource->setResourceStatus($_POST["editResourceStatusValue"]);
    $resource->setOwnerId($_POST["editResourceOwner"]);

    sleep(1);
    
    if (ResourceManagement::changeResourceDetail($resource)) {
        echo ClientReponseGenerator::simpleJsonResponse(1, "", "");
    } else {
        throw new Exception();
    }

} catch (Exception $e) {
    echo ClientReponseGenerator::simpleJsonResponse(0, "EditResourceException", "");
}

?>
